package com.hotel.service.impl;

import java.sql.SQLException;

import com.hotel.bean.Regist;
import com.hotel.dao.UserDao;
import com.hotel.dao.impl.UserDaoImpl;
import com.hotel.service.UserService;

public class UserServiceImpl implements UserService {
	
	UserDao userDao = new UserDaoImpl();
	
	//王俊程
	@Override
	public boolean regist(Regist user) {
		boolean succes = false;
		try {
			succes = userDao.insert(user);
		} catch (SQLException e) {
			e.printStackTrace();
		} catch (Exception e) {
			e.printStackTrace();
		}		
		return succes;
	}

	
	//常开瑞
	@Override
	public Regist login(Regist user) {
		try {
			return userDao.queryByNameAndPsw(user.getPname(), user.getPpassword());
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return null;
	}

	@Override
	public Regist queryById(String id) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Regist queryByName(String name) {
		// TODO Auto-generated method stub
		return null;
	}

}
